
<header class="demo-header">
    <div class="title3Left flt text-center header-small">
        <a href="javascript:history.back(-1);" class="whiteC">
        	<img src="/img/back.png" width="17px" class="backimg">返回
        </a>
    </div>
    <div class="title3Middle flt text-center"><?php echo isset($this->info->title) ? $this->info->title : '' ?></div>
</header>
<form id="articleData" onsubmit="return false" method="post" action="/order/create">
    <input type="hidden" name="article_id" value="<?php echo $this->info->id; ?>">
    <?php
        if(isset($this->info->content)){
            foreach ($this->info->content as $content)  {
                switch ($content->type){
                    case \Orm\ArticleContent\ArticleContentClass::TYPE_TEXT:
                        echo '<div class="select-font return-sousuo" >
                                '.$content->content.'
                            </div>';
                        break;
                    case \Orm\ArticleContent\ArticleContentClass::TYPE_VIDEO:
                        echo '<div class="posre img-width">
                                    <img src="/img/playicon.png" class="playicon"/>
                                    <video class="img-width my_video_1 pause" preload="auto" data-setup="{}">
                                        <source src="'.$content->content.'" type="audio/mp4">
                                    </video>
                                </div>';
                        break;
                    case \Orm\ArticleContent\ArticleContentClass::TYPE_AUDIO:
                        echo '<audio controls="controls" class="img-width"><source src="'.$content->content.'" type="audio/mpeg"></audio>';
                        break;
                    case \Orm\ArticleContent\ArticleContentClass::TYPE_IMG:
                        echo '<img src="'.$content->content.'" class="img-width"/>';
                        break;
                    case \Orm\ArticleContent\ArticleContentClass::TYPE_PRODUCT:
                        $this->salable = true; // 没有一个商品，购买按钮不出来
                        $img_src_str = '';
                        if (isset($content->product_info->image_list)) {
                            $img_src_str = '
                                    <div class="swiper-container">
	                                        <div class="swiper-wrapper">';
                            foreach ($content->product_info->image_list as $img) {
                                $img_src_str .= '
                                                <div class="swiper-slide"><img src="' . $img->url . '" class="img-width"/></div>';
                            }
                            $img_src_str .= '    
                                            </div>
                                            <!-- 如果需要分页器 -->
                                            <div class="swiper-pagination"></div>
                                        </div>';
                        }
                        echo '
                        <div class="padding-top1 border-two fudong" style="margin-bottom: 65px;margin-top: 10px;">
                            '.$img_src_str.'
                            <div  style="width: 95%;" class="div-center padding-adjust3">
                                <div class="img-width">商品名称：'.$content->product_info->name.'</div>
                                <div class="flt pline" style="width: 20%;padding:10px 0 0;">
                                    <p><strong>￥'.$content->product_info->unit_price.'</strong></p>
                                </div>
                                <div class="flt text-right padding-top1" style="width: 80%;">
                                    <div class="inputNum" style="margin-bottom:5px;">
                                        <img src="/img/refund_jian.png" class="minus minadd" onclick="javascript:minus(this);return false;"/>
                                        <span class="proNum" pid="" eid="" cid="">
                                            <input type="text" name="product['.$content->product_info->id.']" productId="" value="1" onblur="javascript:checkIntcart(this);return false;">
                                        </span>
                                        <img src="/img/refund_jia.png" class="add minadd" onclick="javascript:addCart(this);return false;"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        ';
                        break;
                }
            }
        }
    ?>
</form>
<!--<img src="/img/1498186031.jpg" class="img-width"/>-->
<!--<div class="select-font return-sousuo" style="line-height: 28px;">-->
<!--<p style="font-size: 1.05em;margin-left: -5px;"><strong>【产品介绍】</strong></p>-->
<!--	<p>品名：狮峰龙井茶</p>-->
<!--	<p>毛重：250.30g</p>-->
<!--	<p>产地：浙江杭州</p>-->
<!--	<p>茶叶肥嫩，牙峰显露，茶叶较浓；梅家坞所产做工精细，色泽翠绿，形如金针，扁平光滑，汤色碧绿，口味鲜爽。</p>-->
<!--</div>-->
<!--<img src="/img/1498187776(1).jpg" class="img-width"/>-->
<!--<div class="padding-top1 border-two fudong" style="margin-bottom: 65px;margin-top: 10px;">-->
<!--	<div class="swiper-container">-->
<!--	    <div class="swiper-wrapper">-->
<!--	        <div class="swiper-slide"><img src="http://shanguang-img.oss-cn-qingdao.aliyuncs.com/article-material/dZ7x8SG5Kz.png" class="img-width"/></div>-->
<!--	        <div class="swiper-slide"><img src="http://shanguang-img.oss-cn-qingdao.aliyuncs.com/article-material/mcE34pM3hH.jpg"></div>-->
<!--	        <div class="swiper-slide"><img src="/img/~R@_TW0AEA85[UF(`JYU38N.png"/></div>-->
<!--	    </div>-->
	    <!-- 如果需要分页器 -->
<!--	    <div class="swiper-pagination"></div>-->
<!--	</div>-->
<!--	<div  style="width: 95%;" class="div-center padding-adjust3">-->
<!--		<div class="img-width">西湖龙井</div>-->
<!--		<div class="flt pline" style="width: 20%;padding:10px 0 25px;">-->
<!--			<p><strong>￥106.80</strong></p>-->
<!--		</div>-->
<!--		<div class="flt text-right padding-top1" style="width: 80%;">-->
<!--			<div class="inputNum" style="margin-bottom:5px;">-->
<!--				<img src="/img/refund_jian.png" class="minus minadd" onclick="javascript:minus(this);return false;"/>-->
<!--				<span class="proNum" pid="" eid="" cid="">-->
<!--					<input type="text" productId=""  enterpriseId="" channelId=""   value="1" onblur="javascript:checkIntcart(this);return false;">-->
<!--				</span>-->
<!--				<img src="/img/refund_jia.png" class="add minadd" onclick="javascript:addCart(this);return false;"/>-->
<!--		    </div>-->
<!--		</div>-->
<!--	</div>-->
<!--</div>-->

<?php if (isset($this->salable) && $this->salable == true && $this->preview == false):?>
    <a>
        <div class="orangbg padding-adjust4 text-center dibu-fixed" id="order_submit" >立即购买</div>
    </a>

    <script type="application/javascript">
        $('#order_submit').click(function () {
            var all_product_num = $('input[name^=product]').length;
            var zore_amount_num = 0;
            $('input[name^=product]').each(function(){
                if($(this).val() == 0) {
                    zore_amount_num++;
                }
            });
            if (all_product_num == zore_amount_num) {
                alert('最少选着一个商品');
                return false;
            }
            $('#articleData').get(0).submit();
        });
    </script>
<?php endif;?>
